<?php if (!defined('CORE_DIR')) die('Wrong entry point!');

/* 
 * Copyright 2010 Anton Muraviev a.k.a kuromaisu
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

?>
<style type="text/css" media="screen">

/* 
 * Global Reset
 */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
 	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-weight: inherit;
	font-style: inherit;
	font-size: 100%;
	font-family: inherit;
	vertical-align: baseline;
}
select, input, textarea, button {
	vertical-align: middle;
	font-size: 1em;
	color: #333;
}
body {
	font: normal 16px/1.5 Geneva, Verdana, Lucida Sans, Lucida Grande, Lucida Sans Unicode, sans-serif;
	color: #333;
}
ol, ul {
	list-style: none;
}
table {
	border-collapse: separate;
	border-spacing: 0;
} /* tables still need 'cellspacing="0"' in the markup */
caption, th, td {
	text-align: left;
	font-weight: normal;
}
blockquote:before, blockquote:after, q:before, q:after {
	content: "";
}
blockquote, q {
	quotes: "" "";
}
hr {
	display: none;
}

/*
 * Layout
 *
 * TODO: Add gradient background in Firefox and Opera
 */
html {
	padding: 1.5em 14em;
	background: -webkit-gradient(linear, center top, center center, from(#eee), to(#ddd));
	background-repeat: no-repeat;
	background-position: fixed;
	background-color: #ddd;
}
body {
	width: 40em;
	margin: 0 auto;
	padding: 0 1.5em 1.5em;
	background: #fff;
	border-radius: 2px;
	-webkit-border-radius: 2px;
	-moz-border-radius: 2px;
	box-shadow: 0 4px 16px #999;
	-webkit-box-shadow: 0 4px 16px #999;
	-moz-box-shadow: 0 4px 16px #999;
	text-rendering: optimizeLegibility;
}


/*
 * Typography
 */

/* Headers */
h1, h2, h3, h4, h5, h6 {font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-weight: normal;}
h1 {font-size: 2.25em; line-height: 1.3334; margin-bottom: 0.6667em;}
h2 {font-size: 1.5em; line-height: 2;}
h3 {font-size: 1.3125em; line-height: 2.2858;}
h4 {font-size: 1.125em; line-height: 2.6668;}

/* Misc */
p {margin-bottom: 1.5em;}
pre, code, var, kbd, ul.code {font-family: Consolas, "Lucida Console", Monaco, monospace;}
pre {color: #aaa; margin: 0;}

var {color: #0000bb;}
kbd {color: #dd0000;}

/*
 * Widgets
 */

/* Page header */
h1 {
	margin-left: -0.6667em;
	margin-right: -0.6667em;
	border-bottom: 1px solid #bbb;
	line-height: 1.9999;
	padding: 0 0.6667em;
	background-color: #999;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#aaa), to(#999));
	color: #fff;
	border-top-left-radius: 2px;
	-webkit-border-top-left-radius: 2px;
	-moz-border-top-left-radius: 2px;
	border-top-right-radius: 2px;
	-webkit-border-top-right-radius: 2px;
	-moz-border-top-right-radius: 2px;
	text-shadow: 0 1px 1px #333;
	-moz-text-shadow: 0 1px 1px #333;
	-webkit-text-shadow: 0 1px 1px #333;
}

/* Summary */
ul.summary {
	_height: 1%;
	margin-bottom: 1.5em;
	overflow: hidden;
}
ul.summary li {
	width: 33%;
	float: left;
	text-align: center;
	color: #bbb;
}
ul.summary li.total {color: #007700;}
ul.summary li.total em {
	color: #449944;
	-moz-text-shadow: 0 -1px 1px #163216;
	text-shadow: 0 -1px 1px #163216;
}
ul.summary li.failed {color: #d22;}
ul.summary li.failed em {
	color: #e44;
	-moz-text-shadow: 0 -1px 1px #4E1616;
	text-shadow: 0 -1px 1px #4E1616;
}
ul.summary li.skipped {color: #777;}
ul.summary li.skipped em {
	color: #999;
	-moz-text-shadow: 0 -1px 1px #323232;
	text-shadow: 0 -1px 1px #323232;
}
ul.summary em {
	display: block;
	font-size: 72px;
	font-family: Futura, Arial, Trebuchet MS, sans-serif; /* 1's kerning seems to be all wrong in Helvetica */
	font-style: normal;
	line-height: 1;
	color: #ddd;
	-moz-text-shadow: 0 -1px 1px #999;
	text-shadow: 0 -1px 1px #999;
}

/* Specification */
h2, .behavior p.status {
	position: absolute;
	left: -10em;
	width: 8em;
	padding: 0.46em 1em 0.5em 0.5em;
/*	padding-right: 1em;*/
	text-align: right;
	text-shadow: 0 -1px 1px rgba(0,0,0,0.3);
	line-height: 1;
	background: #aaa;
	background: rgba(170,170,170,0.8);
	color: #eee;
	border-radius: 2px;
	-webkit-border-radius: 2px;
	-moz-border-radius: 2px;
	box-shadow: 0 0 4px #ccc;
	-webkit-box-shadow: 0 0 4px #ccc;
	-moz-box-shadow: 0 0 4px #ccc;
}
h2.failed,.behavior p.status.failed {
	background: #f00;
	background: rgba(255,0,0,0.8);
}
h2 span {
	display: block;
	padding-bottom: 0.05em;
}
h2 small {
	display: block;
	font-size: 0.6667em;
/*	line-height: 1.125;*/
}
h2 a {
	position: absolute;
	top: -40px;
	left: 42%;
	display: block;
	width: 33px;
	height: 33px;
	overflow: hidden;
	text-indent: 9999px;
	border-radius: 3px;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	background-repeat: no-repeat;
	background-position: -3px -4px;
}
h2 a:hover {
	background-position: -3px -44px;
}
h2 a.next-spec {
	bottom: -40px;
	top: auto;
	background-position: -4px -4px;
}
h2 a.next-spec:hover{
	background-position: -4px -44px;
}
h2 a.hidden {
	visibility: hidden;
}
.specification {
	position: relative;
}
h2 a:active {
	background-color: rgba(0,0,0,0.1);
}

/* Behaviour */
.behavior h3 {
	border-top: 1px dashed #eee;
	line-height: 1.1429;
	padding: 0.48em 3em 0.5714em 0;
}
.behavior p.status {
	width: auto;
	right: -2.1em;
	left: auto;
	top: 0.5em;
	padding-top: 0.5em;
	color: #fff;
}
.behavior {
	border-top: 1px dashed #aaa;
	position: relative;
	margin-bottom: 1.5em;
}

/* Parameters */
.parameters {
	overflow: hidden;
}
.parameters h4 {
	font-size: 1em;
	line-height: 1.5em;
}
.parameters h4 code {
	vertical-align: middle;
	font-size: 0.8em;
	padding: 1px 1px;
}
.parameters pre.diff, .parameters h4 code {
	background: #eee;
	border: 1px solid #d5d5d5;
	border-top: 1px solid #ddd;
	border-bottom: 1px solid #e8e8e8;
}

.parameters pre {
	max-height: 11.8em;
	font-size: 0.75em;
	padding: 0.25em;
	overflow: auto;
	-0-transition: max-height 0.3s ease-in;
	-webkit-transition: max-height 0.3s ease-in;
	-moz-transition: max-height 0.3s ease-in;
}
.parameters pre {
	max-height: 5.8em;
	background: #ddd;
	border: 1px solid #bbb;
	border-top-color: #aaa;
	border-bottom-color: #ccc;
}
.parameters:hover .source pre {
	max-height: 23.8em;
}
.parameters ins, .parameters del {
	text-decoration: none;
	line-height: 1;
	padding: 0.25em 0;
}
.parameters .lhs {
	width: 48.7%;
	float: left;
}
.parameters .rhs {
	width: 48.7%;
	float: right;
}

/* DIFF highlighting */
pre.diff {
	color: #ccc;
	padding: 0.25em 0;
	white-space: normal;
}
pre.diff li {
	padding: 0 0.25em;
	min-height: 1.5em;
	white-space: pre;
	border-style: solid;
	border-top-color: #eee;
	border-bottom-color: #eee;
}
pre.diff li.first, pre.diff li.first.last {
	min-height: 1.416666667em;
	line-height: 1.416666667;
	border-top-width: 1px;
}
pre.diff li.last, pre.diff li.first.last {
	min-height: 1.416666667em;
	line-height: 1.416666667;
	border-bottom-width: 1px;
}
pre.diff li.first.last {
	min-height: 1.333333333em;
	line-height: 1.333333333;
}
pre.diff li.first ins, pre.diff li.first del {
	padding-top: 0.166666667em;
}
pre.diff li.last ins, pre.diff li.last del {
	padding-top: 0.166666667em;
}
pre.diff li.first.last ins, pre.diff li.first.last del {
	padding-top: 0.166666667em;
	padding-bottom: 0.166666667em;
}
pre.diff li.mod {
	border-top-color: #cebfeb;
/*	border-bottom-color: #cebfeb;*/
	border-bottom-color: #dacaf8;
	background: #dacaf8;
	color: #6B627A;
}
pre.diff li.mod del, pre.diff li.mod ins {
	background: #c58cf5;
	color: #63467a;
}
.rhs pre.diff li.ins {
	border-top-color: #91d99e;
/*	border-bottom-color: #99e5a7;*/
	border-bottom-color: #a2f2b1;
	background: #a2f2b1;
	color: #507858;
}
.lhs pre.diff li.del {
	border-top-color: #e1c1c1;
	border-bottom-color: #eecccc;
	border-bottom-color: #fbd7d7;
	background: #fbd7d7;
	color: #7d6b6b;
}
.rhs pre.diff li.del, .lhs pre.diff li.ins {
	line-height: 1.5;
	min-height: 1.5em;
	border: 0;
	background: #e7e7e7;
}

/* PHP code highlighter */
ul.code {
	overflow-x: auto;
	overflow-y: hidden;
	margin-bottom: 1.5em;
	font-size: 0.75em;
}
ul.code li {
	position: relative;
	padding-left: 4em;
	_zoom: 1;
}
ul.code li:after {
	display: block;
	content: "";
	clear: both;
}
ul.code a.line-num {
	position: absolute;
	left: 0;
	right: 0;
	display: block;
	width: 2.5em;
	padding: 0 0.5em;
	border-right: 1px solid #aaa;
	text-align: right;
	text-decoration: none;
	background: #ddd;
	color: #333;
}
ul.code code {
	white-space: pre;
}


.php-string {color: #dd0000;}
.php-comment {color: #ff8000; font-style: italic;}
.php-keyword {color: #007700;}
.php-code {color: #0000bb;}

/* IMAGES */
h2 a {
	background-image: url('')
}
h2 a.prev-spec {
	background-image: url('');
}
.rhs pre.diff li.del {
	background-image: url('');
}
.lhs pre.diff li.ins {
	background-image: url('');
}
</style>
<script type="text/javascript" charset="utf-8">
// ==============================================
// = Sync source code boxes' scrolling position =
// ==============================================
// 
// Also, single out spans of LIs with the same class and apply
// classes to first and last element (.first and .last respectively).
// 
function getElementsByClassName(elName, classname, node)  {
	if (!node) {
		node = document.getElementsByTagName("body")[0];
	}
	
	var a = [],
		re = new RegExp('\\b' + classname + '\\b'),
		els = node.getElementsByTagName(!elName ? "*" : elName);
	
	for (var i=0,j=els.length; i<j; i++) {
		if(re.test(els[i].className)) a.push(els[i]);
	}
	return a;
}
// addEvent and removeEvent by John Resig
function addEvent(obj, type, fn) {
	if (obj.attachEvent) {
		obj['e'+type+fn] = fn;
		obj[type+fn] = function(){obj['e'+type+fn](window.event);};
		obj.attachEvent('on'+type, obj[type+fn]);
	} else {
		obj.addEventListener( type, fn, false );
	}
}
function removeEvent(obj, type, fn) {
	if ( obj.detachEvent ) {
		obj.detachEvent('on'+type, obj[type+fn]);
		obj[type+fn] = null;
	} else {
		obj.removeEventListener(type, fn, false);
	}
}

// Sync Scroller
function syncScrollPosition(subject,target) {
	if (typeof(subject.onscroll) === 'undefined') {
		var timer;
		addEvent(subject,'mouseover',function() {
			timer = setInterval(function() {
				target.scrollTop = subject.scrollTop;
				target.scrollLeft = subject.scrollLeft;
			},40);
		});
		addEvent(subject,'mouseout',function() {
			clearTimeout(timer);
		});
	} else {
		addEvent(subject,'scroll',function() {
			target.scrollTop = subject.scrollTop;
			target.scrollLeft = subject.scrollLeft;
		});
	}
}

// Initialization
addEvent(window,'load',function() {
	var lhs = getElementsByClassName('div','source lhs'),
		rhs = getElementsByClassName('div','source rhs');
	
	if (lhs.length !== rhs.length) {
		return;
	}
	
	for (var i=0, left, right; left = lhs[i], right = rhs[i]; i++) {
		var leftPre = getElementsByClassName('pre','diff',left)[0],
			rightPre = getElementsByClassName('pre','diff',right)[0];

		if (!leftPre || !rightPre) continue;

		syncScrollPosition(leftPre, rightPre);
		syncScrollPosition(rightPre, leftPre);
		leftPre.getElementsByTagName('ul')[0].style.minWidth = (leftPre.scrollWidth) + 'px';
		rightPre.getElementsByTagName('ul')[0].style.minWidth = (rightPre.scrollWidth) + 'px';
		
		leftLIs = leftPre.getElementsByTagName('li');
		rightLIs = rightPre.getElementsByTagName('li');
		
		if (leftLIs.length !== rightLIs.length) {
			continue;
		}
		
		var leftClass = '',
			rightClass = '';
		
		for (var j=0, leftLI, rightLI, _lc, _rc = ''; leftLI = leftLIs[j], rightLI = rightLIs[j]; j++) {
			_lc = leftLI.className;
			_rc = rightLI.className;
			
			if (leftLI.className !== leftClass) {
				leftLI.className+= ' first '; 
			}
			if ((j + 1) == leftLIs.length || leftLIs[j+1].className !== _lc) {
				leftLI.className+= _lc ? ' last ' : 'last';
			}
			if (rightLI.className !== rightClass) {
				rightLI.className+= ' first'; 
			}
			if ((j + 1) == rightLIs.length || rightLIs[j+1].className !== _rc) {
				rightLI.className+= _rc ? ' last ' : 'last';
			}
			
			leftClass = _lc;
			rightClass = _rc;
		}
	}
});
</script>